//
//  YYT_YuedanTableViewCell.m
//  AudioVisualFeast
//
//  Created by 张琪 on 16/1/28.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "QL_SearchYuedanTableViewCell.h"

@interface QL_SearchYuedanTableViewCell ()
@property (nonatomic, retain) UILabel *yiren;
@property (nonatomic, retain) UILabel *name;
@property (nonatomic, retain) UILabel *relateTime;
@property (nonatomic, retain) UILabel *boTimes;
@property (nonatomic, retain) UILabel *pcTimes;
@property (nonatomic, retain) UILabel *ydTimes;
@property (nonatomic, retain) UILabel *miaoshu;
@end

@implementation QL_SearchYuedanTableViewCell
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.yiren = [[UILabel alloc] initWithFrame:CGRectZero];
        self.yiren.font = [UIFont systemFontOfSize:10];
        self.yiren.textColor = [UIColor colorWithRed:30 / 255.0 green:195 / 255.0 blue:153 / 255.0 alpha:1.0];
        [self addSubview:self.yiren];
        
        self.name = [[UILabel alloc] initWithFrame:CGRectZero];
        self.name.font = [UIFont fontWithName:@"Helvetica-Bold" size:13];
        self.name.textColor = [UIColor whiteColor];
        [self addSubview:self.name];
        
        self.relateTime = [[UILabel alloc] initWithFrame:CGRectZero];
        self.relateTime.font = [UIFont systemFontOfSize:10];
        self.relateTime.textColor = [UIColor whiteColor];
        [self addSubview:self.relateTime];
        
        self.boTimes = [[UILabel alloc] initWithFrame:CGRectZero];
        self.boTimes.font = [UIFont systemFontOfSize:10];
        self.boTimes.textColor = [UIColor whiteColor];
        [self addSubview:self.boTimes];
        
        self.pcTimes = [[UILabel alloc] initWithFrame:CGRectZero];
        self.pcTimes.font = [UIFont systemFontOfSize:10];
        self.pcTimes.textColor = [UIColor whiteColor];
        [self addSubview:self.pcTimes];
        
        self.ydTimes = [[UILabel alloc] initWithFrame:CGRectZero];
        self.ydTimes.font = [UIFont systemFontOfSize:10];
        self.ydTimes.textColor = [UIColor whiteColor];
        [self addSubview:self.ydTimes];
        
        self.miaoshu = [[UILabel alloc] initWithFrame:CGRectZero];
        self.miaoshu.font = [UIFont systemFontOfSize:10];
        self.miaoshu.textColor = [UIColor whiteColor];
        [self addSubview:self.miaoshu];
        
    }
    return self;
}

-(void)layoutSubviews {
    [super layoutSubviews];
    self.yiren.frame = CGRectMake(15, 40, 200, 10);
    self.name.frame = CGRectMake(15, 20, 300, 10);
    self.relateTime.frame = CGRectMake(self.yiren.frame.size.width, 40, 200, 10);
    self.boTimes.frame = CGRectMake(15, 70, 100, 10);
    self.pcTimes.frame = CGRectMake(self.boTimes.frame.size.width + 30, 70, 80, 10);
    self.ydTimes.frame = CGRectMake(self.yiren.frame.size.width + self.boTimes.frame.size.width - 50, 70, 110, 10);
    self.miaoshu.frame = CGRectMake(15, 90, self.frame.size.width - 50, 80);
    self.miaoshu.numberOfLines = 4;
}



-(void)setArray:(NSArray *)array {
    _array = array;
    self.name.text = self.array[0];
    self.relateTime.text = [NSString stringWithFormat:@"更新时间：%@", _array[1]];
    self.boTimes.text = [NSString stringWithFormat:@"播放次数：%@", _array[2]];
    self.pcTimes.text  = [NSString stringWithFormat:@"收藏数：%@", _array[3]];
    self.ydTimes.text = [NSString stringWithFormat:@"获得积分：%@", _array[4]];
    self.yiren.text = [NSString stringWithFormat:@"作者：%@", _array[5]];
    NSString* headerData =_array[6];
    //去除掉首尾的空白字符和换行字符
    headerData = [headerData stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
    headerData = [headerData stringByReplacingOccurrencesOfString:@"\r" withString:@""];
    headerData = [headerData stringByReplacingOccurrencesOfString:@"\n" withString:@""];
    self.miaoshu.text = headerData;
    
    
    
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
